package cn.edu.hunau.java.week03.day02;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import static com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver.iterator;

public class InitTest {
    @Test
    public void testInit(){
        List<String> list1=new ArrayList<>();
        list1.add("abc");
        list1.add(0,"def");
        list1.add("ghi");
        list1.add("ghi");
        System.out.println(list1);
        for(int i=0;i<list1.size();i++){
            System.out.println(list1.get(i)+" ");
        }
        System.out.println();
        for(String data:list1){
            System.out.println(data+"");
        }
        System.out.println();
        Iterator<String> iter=list1.iterator();
        while(iter.hasNext()){
            String value=iter.next();
            System.out.println(value+"");
        }
    }
}
